#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([c-abci], [1.0.0], [rabbit@pear.hk])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

## ADD
AC_CONFIG_AUX_DIR(auto)
AC_CONFIG_MACRO_DIR([m4])
LI_INIT([])
AC_PROG_LIBTOOL

AM_INIT_AUTOMAKE([subdir-objects foreign  -Wno-gnu -Werror])


# Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#AC_PROG_RANLIB

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lcrypto':
AC_CHECK_LIB([crypto], [ECDSA_verify], [], [
	echo "Error: Need Install libcrypto"
	exit -1
])
# FIXME: Replace `main' with a function in `-lcurl':
AC_CHECK_LIB([curl], [curl_easy_getinfo], [], [
	echo "Error: Need Install libcurl"
	exit -1
])
# FIXME: Replace `main' with a function in `-lssl':
AC_CHECK_LIB([ssl], [EC_KEY_new_by_curve_name], [], [
	echo "Error Need Install libssl"
	exit -1
])
# FIXME: Replace `main' with a function in `-lglib-2.0':
AC_CHECK_LIB([glib-2.0], [g_list_append], [], [
	echo "Error Need Install libglib-2.0"
	exit -1
])

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h sys/statvfs.h sys/time.h unistd.h utime.h protobuf-c/protobuf-c.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRERROR_R
AC_FUNC_STRTOD
AC_CHECK_FUNCS([clock_gettime fdatasync getpagesize gettimeofday localeconv localtime_r memchr memmove memset socket strcasecmp strchr strdup strerror strncasecmp strstr strtol utime])

AC_CONFIG_FILES([Makefile
                 libhiredis/Makefile
                 libjansson/Makefile
                 libsqlite/Makefile
                 src/Makefile])
AC_OUTPUT
